cmake_minimum_required(VERSION 3.27)
project(cwb2048)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_PREFIX_PATH $ENV{QT_HOME})
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/${PROJECT_NAME})

if (MSVC)
    add_compile_options(/utf-8)
else ()
    add_compile_options(-finput-charset=UTF-8)
endif ()

find_package( Qt6 COMPONENTS
            Core
            Gui
            Widgets
            QUIET
    )

# 根据构建类型后缀
if (CMAKE_BUILD_TYPE MATCHES "Debug")
    set(GENERATE_SUFFIX "d")
else ()
    set(GENERATE_SUFFIX "")
endif ()

file(GLOB GAME_SOURCE
        ./src/*.cpp
        ./src/*.h
)

add_executable(${PROJECT_NAME}
        ${GAME_SOURCE}
)
target_link_libraries(${PROJECT_NAME} PRIVATE
        Qt6::Core
        Qt6::Gui
        Qt6::Widgets
)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${GENERATE_SUFFIX}")

